/*
 * config_eth.h
 *
 *  Created on: Aug 1, 2013
 *      Author: Ken Arok
 *
 *
 * \brief Hardware Layer Abstraction of Ethernet Configuration
 *
 * Copyright (c) 2013 PT Hanindo Automation Solutions. All rights reserved.
 *
 */

#include "config_board.h"

#if BOARD_1_0_USED

#ifndef CONFIG_ETH_H_
#define CONFIG_ETH_H_


/*! Ethernet PHY definition. */
#define ETHENET_PHY_DP83848

/*! Number of receive buffers. Max Ethernet frame size is 1526. A Rx buffer is
128 Bytes long. So 12 Rx buffers are necessary to store one max sized frame.
Multiply that by 2 for performance. */
#define ETHERNET_CONF_NB_RX_BUFFERS			24

/*! USE_RMII_INTERFACE must be defined as 1 to use an RMII interface, or 0
to use an MII interface. */
#define ETHERNET_CONF_USE_RMII_INTERFACE	1

/* Define as 1 if use PHY interrupt, or 0 if polling. */
#define ETHERNET_CONF_USE_PHY_IT			1

/*! Number of Transmit buffers */
#define ETHERNET_CONF_NB_TX_BUFFERS			10

/*! Size of each Transmit buffer. */
#define ETHERNET_CONF_TX_BUFFER_SIZE		512

/*! Clock definition */
#define ETHERNET_CONF_SYSTEM_CLOCK			48000000

/*! Use Auto negotiation to get speed and duplex. */
#define ETHERNET_CONF_AN_ENABLE						1

/*! Use auto cross capability. Used by default. */
#define ETHERNET_CONF_AUTO_CROSS_ENABLE				1
/*! Use direct cable. Ignored when ETHERNET_CONF_AN_ENABLE and
    ETHERNET_CONF_AUTO_CROSS_ENABLE are enabled. */
#define ETHERNET_CONF_CROSSED_LINK					0


/* Ethernet default parameters */
/* If MAC Address Chip is not available */
#define ETHERNET_CONF_ETHADDR0						0x00
#define ETHERNET_CONF_ETHADDR1						0x14
#define ETHERNET_CONF_ETHADDR2						0x22
#define ETHERNET_CONF_ETHADDR3						0xBE
#define ETHERNET_CONF_ETHADDR4						0x17
#define ETHERNET_CONF_ETHADDR5						0xEF

/*! The local IP address being used. */
#define ETHERNET_CONF_IPADDR0						127
#define ETHERNET_CONF_IPADDR1						0
#define ETHERNET_CONF_IPADDR2						0
#define ETHERNET_CONF_IPADDR3						1

/*! The gateway address being used. */
#define ETHERNET_CONF_GATEWAY_ADDR0					127
#define ETHERNET_CONF_GATEWAY_ADDR1					0
#define ETHERNET_CONF_GATEWAY_ADDR2					0
#define ETHERNET_CONF_GATEWAY_ADDR3					1

/*! The network mask being used. */
#define ETHERNET_CONF_NET_MASK0						255
#define ETHERNET_CONF_NET_MASK1						255
#define ETHERNET_CONF_NET_MASK2						255
#define ETHERNET_CONF_NET_MASK3						0


#if (LWIP_DNS == 1)
// Default this must be server address
#error "Please, sets the DNS domain address using define DNS_SERVER_NAME, and remove this #error"
// This is used if DNS is enable
#define DNS_SERVER_NAME "yourdnsdomain.com"
#endif

#endif /* CONFIG_ETH_H_ */

#endif /* BOARD_1_0_USED */
